package groovy;

import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyObject;

import java.io.File;
import java.io.IOException;

public class GroovyScriptRun {
    public static void main(String [] args){
        String property = System.getProperty("user.dir");
        GroovyClassLoader groovyClassLoader=new GroovyClassLoader();
        Class clazz = null;

            try {
                clazz = groovyClassLoader.parseClass(new File("G:\\worksp\\DataModel\\src\\main\\java\\groovy\\run.groovy"));
            } catch (IOException e) {
                e.printStackTrace();
            }

        Object o;

            try {
                o = clazz.newInstance();
                GroovyObject groovyObject = (GroovyObject)o;
                groovyObject.invokeMethod("run","bbb");
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
    }

}
